<?php
class indexAction extends frontAction{
    public function execute(){
        $key = $this->getGetParam('key',0);
        $user = new DaoUser();
        list($users,$page) = $user->getListPage("keyword like '%".$key."%' order by sortID ASC",10);
        
        $product = new DaoProduct();
        list($product,$page2) = $product->getListPage("keyword like '%".$key."%' order by sortID ASC",10);
        
        $this->assign('users',$users);
        $this->assign('product',$product);
        //$this->assign('page',$page);
        //$this->assign('page2',$page2);
        
    }
    
    public function executePost(){
        $type = $this->getPostParam("type",null);
        $findName = $this->getPostParam("findName",null);
        if($type == "user"){
            $user = new DaoUser();
            list($users,$page) = $user->getListPage("keyword like '%".$findName."%' order by sortID ASC",10);
            $this->assign('users',$users);
        }else if($type == "product"){
            $product = new DaoProduct();
            list($product,$page2) = $product->getListPage("keyword like '%".$findName."%' order by sortID ASC",10);
            $this->assign('product',$product);
        }
    }
}
?>